Boost
boost
arrow_drop_down
Boost.Optional
C++ 11 Added in Boost 1.30.0
Categories: Data

A value-semantic, type-safe wrapper for representing 'optional' (or 'nullable') objects of a given type. An optional object may or may not contain a value of the underlying type.

This Release

Fernando Cacciola
Author
Andrzej Krzemienski
Andrzej Krzemienski
Maintainer
Benjamin Roland Buch
Benjamin Roland Buch
Contributor - New
Tolga HOŞGÖR
Tolga HOŞGÖR
Contributor - New
Anthony Leedom
Anthony Leedom
Contributor - New
Anthony
Anthony
Contributor - New
Daniel Seither
Daniel Seither
Contributor - New
Rene Rivera
Rene Rivera
Contributor

optional

A library for representing optional (nullable) objects in C++.

optional<int> readInt(); // this function may return either an int or a not-an-int

if (optional<int> oi = readInt()) // did I get a real int
  cout << "my int is: " << *oi;   // use my int
else
  cout << "I have no int";

For more information refer to the documentation provided with this library.

All Time

Fernando Cacciola
Fernando Cacciola
Contributor
Steven Watanabe
Steven Watanabe
Contributor
Beman Dawes
Beman Dawes
Contributor
Daniel James
Daniel James
Contributor
nobody
Contributor
Niels Dekker
Contributor
Dave Abrahams
Dave Abrahams
Contributor
Stephen Kelly
Stephen Kelly
Contributor
Andrey Semashev
Andrey Semashev
Contributor
Troy D. Straszheim
Troy D. Straszheim
Contributor
Marshall Clow
Marshall Clow
Contributor
Vladimir Prus
Vladimir Prus
Contributor
Douglas Gregor
Douglas Gregor
Contributor
Matias Capeletto
Matias Capeletto
Contributor
John Maddock
John Maddock
Contributor
Hartmut Kaiser
Hartmut Kaiser
Contributor
Michael A. Jackson
Michael A. Jackson
Contributor
Jens Maurer
Jens Maurer
Contributor
Vicente J. Botet Escriba
Vicente J. Botet Escriba
Contributor
Markus Schöpflin
Contributor
Jeremiah Willcock
Jeremiah Willcock
Contributor
Gennaro Prota
Contributor
Jürgen Hunold
Jürgen Hunold
Contributor
Gennadiy Rozental
Gennadiy Rozental
Contributor
Olaf van der Spek
Olaf van der Spek
Contributor
drivehappy
drivehappy
Contributor
Stefan Seefeld
Stefan Seefeld
Contributor
Kazutoshi SATODA
Kazutoshi SATODA
Contributor
Sebastian Redl
Contributor
Andrey Semashev
Andrey Semashev
Contributor
Siddhant Saraf
Siddhant Saraf
Contributor
Aleksey Gurtovoy
Contributor
akumta
akumta
Contributor
Fredrik Blomqvist
Contributor
Ralf W. Grosse-Kunstleve
Contributor
Marcel Raad
Marcel Raad
Contributor